]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/network: Add activate() in NMSection
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 3 Aug 2022 04:44:36 +0000 (06:44 +0200)
committerMarge Bot <marge-bot@gnome.org>
Wed, 10 Aug 2022 16:37:15 +0000 (16:37 +0000)
As the sections are about to turn into quick toggles, they need
to be able to perform an action on click.

Add an activate() method for that purpose, which either disconnects
all active items, or connects the primary item.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>

js/ui/status/network.js

index 1beab28c1f3ad1056be0c2cb973ab85dfddf3c0c..994c35c134b3a4527deb3bf1050006e669ba2ff9 100644 (file)
@@ -1343,6 +1343,15 @@ const NMSection = GObject.registerClass({
         this.menu.actor.visible = visible;
     }
 
+    activate() {
+        const activeItems = [...this._getActiveItems()];
+
+        if (activeItems.length > 0)
+            activeItems.forEach(i => i.activate());
+        else
+            this._itemBinding.source?.activate();
+    }
+
     _loadInitialItems() {
         throw new GObject.NotImplementedError();
     }